<!DOCTYPE html>
<html lang="en" xmlns:v-on="http://www.w3.org/1999/xhtml" xmlns:v-model="http://www.w3.org/1999/xhtml"
      xmlns:on-click="http://www.w3.org/1999/xhtml">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
</head>
<body>
<div id="app">
    g_num={}
    <counter v-on:pluse="gNumPlus" v-on:pluse="gNumReduce" v-bine:num="g_num"></counter>
</div>

<script type="text/javascript">

    const counter={
        template:`
        <div>
            <button on-click:="numPlus">增加</button>
            <button on-click:="numReduce">减少</button>
        </div>`
        ,
        data(){
                return {num}
        },
        methods:{
            numPlus(){
                console.log(this.num);
                return this.$emit("plus");
            },numReduce(){
                console.log(this.num);
                return this.$emit("reduce");
            }
        }
    }

    Vue.component("counter",counter)

    var app = new Vue({
        el: "#app",
        data: {
            G_num:0
        },
    });
</script>
</body>
</html>